﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace DataShow
{
    public class DictionaryConverter
    {
        #region 要素代码与值转换
        /// <summary>
        /// 要素代码与值转换
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static string ConvertElement(string input)
        {
            switch (input)
            {
                case "mint": return "最低温";
                case "maxt": return "最高温";
                case "wth": return "降水";
                default: return "未知参数";
            }
        } 
        #endregion

        
    }

    public class Common
    {
        #region 在页面的最后面注册一个代码块
        /// <summary>
        /// 在页面的最后面注册一个代码块
        /// </summary>
        /// <param name="scriptCode">JavaScript可以执行的源代码 例如 "alert(1111)"</param>
        public static void RegisterScriptAtPageLast(Page page, string scriptCode)
        {
            System.Web.UI.HtmlControls.HtmlGenericControl js = new System.Web.UI.HtmlControls.HtmlGenericControl();
            js.TagName = "script";
            js.Attributes.Add("type", "text/javascript");
            js.InnerHtml = scriptCode;


            page.Controls.Add(js);
        }
        #endregion

        #region 全选checkboxlist
        /// <summary>
        /// 全选checkboxlist
        /// </summary>
        /// <param name="cbl"></param>
        public static void CheckAllCheckbox(CheckBoxList cbl)
        {
            foreach (ListItem item in cbl.Items)
            {
                item.Selected = true;
            }
        }
        #endregion

        
    }
}